package schema

import (
	"private-domain-overseas-service/pkg/status/bizblockchain"
	"time"

	"entgo.io/ent"
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/schema"
	"entgo.io/ent/schema/field"
	"entgo.io/ent/schema/index"
)

// HzBlockchainWallet holds the schema definition for the HzBlockchainWallet entity.
type HzBlockchainWallet struct {
	ent.Schema
}

// Fields HzBlockchainWallet Fields of the HzBlockchainWallet.
func (HzBlockchainWallet) Fields() []ent.Field {
	return []ent.Field{
		field.Int64("user_id").Comment("钱包用户id"),
		field.String("wallet_address").MaxLen(500).NotEmpty().Comment("钱包地址"),
		field.String("wallet_private_key").MaxLen(500).Optional().Comment("钱包私钥"),
		field.Int64("wallet_status").Default(bizblockchain.Enabled).Comment("钱包状态，1、启用，2、禁用"),
		field.Int64("created_at").Immutable().Optional().Comment("创建时间"),
		field.Int64("update_at").Default(time.Now().Unix()).Comment("更新时间"),
		field.Int64("delete_at").Optional().Comment("删除时间"),
	}
}

// Indexes of the Street.
func (HzBlockchainWallet) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("user_id"),
		index.Fields("wallet_address"),
		index.Fields("wallet_status"),
	}
}

func (HzBlockchainWallet) Annotations() []schema.Annotation {
	return []schema.Annotation{
		entsql.WithComments(true),
		schema.Comment("区块链钱包表"),
	}
}
